ASN_IPFire_Script - Changelog 
=============================

For notes about updating from older versions see the end of this file.

___
Change log
----------
v0.8.1 (2023-03-18)
- unified script (termux version removed)
- code optimization (speed up and cosmetic)

v0.8.0 (2023-01-21)
- added option "--iprange"
- removed options "--iptable" and "--afwall"
- fixed grep: warning: stray \ before / 
- code optimization (speed up and cosmetic)

v0.7.13 (2022-05-13)
- changed default ASN source to cidr-report.org again
- adjusted bgplookingglass.com source

v0.7.12 (2021-05-18)
- fixed and improved availability check (but still very rudimentary)

v0.7.11 (2021-05-18)
- changed default ASN source to bgplookingglass.com since cidr-report.org is not reachable anymore
- added optional ASN source gbpview.io (no support for company names with white spaces)
- added optional Network source gbpview.io
- removed ASN source ultratools (service not available anymore)
- removed "preferred_version=1.1" from NET_ripe URL
- code optimization

v0.7.10 (2020-04-19)
- added option "-c, --check"
- hidden option "--iptable, --afwall" (use "--custom" instead)
- code optimization
- added exit codes

v0.7.9 (2019-12-21)
- added optional configuration file
- added custom output format
- added custom output file
- added option "--raw"
- removed option "--network_raw"
- added interactive switch

v0.7.8 (2019-05-06)
- fixed a bug in ipfire mode, with company names containing spaces or wildcards
- changed: files are written only at the end of the script
- speed up option "--asn"
- added warning in ipfire mode, in case of single IPs
- added md5 and sha1 hashes 
- code optimization

v0.7.7 beta (2019-03-18)
- added compatibility with FreeBSD, MacOS (thanks to MyLogin)
- added a termux version for Android as separate script (thanks to MyLogin)

v0.7.6 (2018-09-24)
- fixed adjacent consolidation function
- code optimization

v0.7.5 (2018-09-23)
- bug: adjacent consolidation function deactivated
- code optimizations (thanks to Dimitar)

v0.7.4 (2018-02-11)
- auto upper-case group names in ipfire
- fixed issue with some wget versions
- added variable to use curl over wget
- added option --sort
- code optimization
- added fair use hints

v0.7.3 (2017-11-25)
- fixed not working option --file

v0.7.2 (2017-11-19)
- improved query

v0.7.1 (2017-11-19)
- bugfix

v0.7 (2017-11-19)
- changed default ASN source to cidr-report
- added whois query to alternative sources
- optimized company name handling
- simplified source selection
- speed up static sources
- auto select wget or curl
- disabled networks ending with prefix "/0"
- added simple backup/restore function 
- changed option -v (verbose) and -V (version)
- added options keep, restore, backup, rmbackup 

v0.6.3 (2017-08-30) (beta only)
- added support for companies with space in the name
- forced https only for wget

v0.6.2 (2017-08-25)
- exchanged curl with wget
- added info about result file in non-ipfire mode
- fixed alternative sources functions

v0.6.1 (2017-08-22)
- bugfix on some systems

v0.6.0 (2017-08-21)
- fixed missing networks on 32 bit systems
- fixed network_raw mode
- added stats function via verbose parameter 
- eliminated bc dependency
- added function for network-source ipinfo.io
- code optimization (ip filter from source, cosmetics)
- switched mathematics to work on 32 bit

v0.5.2 (2017-06-19)
- first public beta
- added consolidation of dublicate and adjacents networks
- integrated ipfire, afwall and iptables output into one script
- added different features

___
Update from older versions
--------------------------

#### Update to version 0.8.1 ####
Special termux version removed. To run asn_script under termux make small changes in the config file as described in the wiki page 3

### Update to version 0.8 ###
Compatibility break! 
From version 0.8.0 on, the options "--iptable" and "--afwall" have been removed as well as the corresponding default output file names. Results will now be written to the output file "asn_result.lst" by default. A custom specific filename is still possible via the configuration file. In the template configuration file examples are given, how to get the same results as from the removed options. These changes are irrelevant for the ipfire mode.

New option "--iprange" has been implemented which significantly speed up the consolidation of big networks. This parameter makes use of the external tool [iprange](https://github.com/firehol/iprange) from [The FireHol Project](https://firehol.org/). An executable iprange is provided for AMD64 and ARM64 architecture, to be placed in the script folder by default. But it is recommended to build it by yourself according to the instructions on the developers Github page.

#### Update to version 0.7.13 ####
cidr-report is back and set as ASN default source again. To get bgplookingglass source work properly again, small redirect adjustments were done. 

#### Update to version 0.7.11 ####
The default ASN source cidr-report seems to be down. Therefore the default source has been switched to bgplookingglass. This has to be considered because it's only available with http protocol! Alternatively the newly added bgpview.io can be selected, which has other drawbacks like no white space support in the company names and it's rarely tested so far.

#### Update to version 0.7.10 ####
To reduce the risk of cleared network entries, the new option "-c" or "--check" can be used to perform a previous availability check of all activated sources. In case that any source cannot be reached, the script will stop without any changes to the ipfire. This option might be set by default in later versions.  
**Note:** Even with this option activated, wrongly blank network entries can still happen, e.g. if a source is not reachable after the pre-check or if the source contain no data, etc. 

#### Update to version 0.7.9 ####
This version added options for a custom specific output format and output file. Also all script header variables can now be changed in an optional configuration file "asn_script.conf" (default name).  

Mainly intended for the IPFire mode, there is now an option "-i" or "--interactive", which allows to stop the script before overwriting existing files.

Option "--network_raw" has been removed. An equivalent output result can be achieved with the option "--network", combined with the new option "--raw". Latter option can also be combined with the other modes.

#### Update to version 0.7.8 ####
This version fixes a bug that is relevant in IPFire mode. It can lead to a grow up of the customgroups and customnetworks files and to misadjusted firewall rules. It only occurs, __if the company names contains spaces (~) or wildcards (*)__.  
Therefore **it is recommended to run** 
**`asn_ipfire.sh --remove ALL`**
once, to clean up these files. Then run asn_script as usually. And finally re-assure that your IPFire firewall rules are still correctly assigned:  
`IPFire GUI --> Firewall Rules --> Edit all rules with company names --> re-assign the "Network/Host Groups" --> Update --> Apply changes`

Files are only written at the end of the script now. This allows a cancellation (CTRL-C) any time before the last company has been fully consolidated. 

#### Update to version 0.7.4+ ####
IPfire firewall rules are case sensitive. This leads to wrong assignment if the script is run with different spellings of company names. To prevent the risk of non-blocking groups due to accidentally misspelling, company names are written uppercase now. **This requires once a manual re-assignment inside IPFire firewall rules.** Run the script with all company names you want to block and do following steps in IPFire:  
`IPFire GUI --> Firewall Rules --> Edit all rules with company names --> re-assign the "Network/Host Groups" --> Update --> Apply changes`


#### Update to version 0.7+ ####
If you update from previous versions be aware that the format of COMPANY names has been changed.   
**Only comma separation is supported now.** Company names must no longer be separated by spaces.   
This may affect you, if you automatically start the script, e.g. via crontab or an launcher script. Also if you use a company file, which contains space saparated names, you need to adapt it.  

The default source for ASN entries has been switched from [ultratools](https://www.ultratools.com) to [cidr-report](https://www.cidr-report.org/) . That is because results from cidr-report seemed to be more complete. Because of this change, the script will take a bit longer, depening on the download transfer rate and the number of companies to be processed. See the wiki page how to change the sources.
 
